package com.qiangesoft.bootcodegen.constant;

import com.qiangesoft.bootcodegen.utils.TableColumnInitUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * 代码生成通用常量
 *
 * @author qiangesoft
 * @date 2024-03-29
 */
public class CodegenConstant {

    /**
     * 默认数据源id
     */
    public static final Long MASTER_DATA_SOURCE_ID = 0L;

    /**
     * 默认数据源名称
     */
    public static final String MASTER_DATA_SOURCE_NAME = "默认数据源";

    /**
     * id
     */
    public static final String ID = "id";

    /**
     * 创建人
     */
    public static final String CREATE_BY = "create_by";

    /**
     * 创建时间
     */
    public static final String CREATE_TIME = "create_time";

    /**
     * 更新人
     */
    public static final String UPDATE_BY = "update_by";

    /**
     * 更新时间
     */
    public static final String UPDATE_TIME = "update_time";

    /**
     * 乐观锁
     */
    public static final String VERSION = "version";

    /**
     * 逻辑删除
     */
    public static final String DELETED = "deleted";

    /**
     * 基类字段
     */
    public static final String[] BASE_COLUMN = {CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME};

    /**
     * 无需展示字段
     */
    public static final String[] NOT_DISPLAY_COLUMN = {ID, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, VERSION, DELETED};

    /**
     * 字段配置
     */
    public static final Map<String, String> COLUMN_CONFIG = new HashMap<>();

    /**
     * 字段配置
     */
    static {
        COLUMN_CONFIG.put(TableColumnInitUtil.underlineToCamel(CREATE_BY), CREATE_BY);
        COLUMN_CONFIG.put(TableColumnInitUtil.underlineToCamel(CREATE_TIME), CREATE_TIME);
        COLUMN_CONFIG.put(TableColumnInitUtil.underlineToCamel(UPDATE_BY), UPDATE_BY);
        COLUMN_CONFIG.put(TableColumnInitUtil.underlineToCamel(UPDATE_TIME), UPDATE_TIME);
        COLUMN_CONFIG.put(TableColumnInitUtil.underlineToCamel(VERSION), VERSION);
        COLUMN_CONFIG.put(TableColumnInitUtil.underlineToCamel(DELETED), DELETED);
    }
}
